<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>

<body>
    <script>
        Function.prototype.addMethod = function (name, fn) {
            this.prototype[name] = fn
            return this;
        }

        var fn = function () {

        }
        fn.addMethod("getData", function () {
            console.log("getData")
        })

        var data = new fn()
        console.log(data)
        data.getData()
    </script>
</body>

</html>